package com.itheima.redbaby.dao.impl;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.itheima.redbaby.ContantValue;
import com.itheima.redbaby.GloableParams;
import com.itheima.redbaby.dao.CategoryDao;
import com.itheima.redbaby.dao.base.DaoImpl;
import com.itheima.redbaby.dao.domain.CategoryDo;

public class CategoryDaoImpl extends DaoImpl<CategoryDo> implements CategoryDao {

	@Override
	public float getCategoryVersion() {
		SharedPreferences sp = GloableParams.context.getSharedPreferences(ContantValue.VERSION_FILE, Context.MODE_PRIVATE);
		float version = sp.getFloat(ContantValue.VERSION_CATEGORY, 0);
		return version;
	}

	@Override
	public void setCategoryVersion(float version) {
		SharedPreferences sp = GloableParams.context.getSharedPreferences(ContantValue.VERSION_FILE, Context.MODE_PRIVATE);
		Editor editor = sp.edit();
		editor.putFloat(ContantValue.VERSION_CATEGORY, version);
		editor.commit();
	}
}
